
import { fetch } from '@/serve';

export function get(dept_id: number) {
    const queryString = new URLSearchParams(filterEmpty({ dept_id: `${dept_id}` })).toString();
    return fetch(`/departments/user?${queryString}`, {
        method: 'GET',
    })
}

/** 对象去空 */
export function filterEmpty(obj: any) {
    const newObj: any = {};
    for (const key in obj) {
        if (obj[key] !== null && obj[key] !== undefined && obj[key] !== 'undefined') {
            newObj[key] = obj[key];
        }
    }
    return newObj;
}